package controller

import (
	"encoding/json"
	"github.com/gin-gonic/gin"
	"house-property/common"
	"house-property/model"
	"log"
)

func Gethouse(ctx *gin.Context){
	DB:=common.InitDB()
	b, _ := ctx.GetRawData()
	var m map[string]string
	_ = json.Unmarshal(b, &m)
	var sta []model.House
	var r model.Register_im
	DB.Find(&sta)
	i:=0
	for ;i<len(sta);i++{
		DB.Where("num = ?", sta[i].Name).First(&r)
		sta[i].Name=r.Name
	}
	log.Println(sta)
	ctx.JSON(200,sta)
}
